// 管理员接口模块

import axios from "../utils/request";

// 登录
export const loginApi = (data) =>
  axios({
    url: "index/login",
    method: "post",
    data,
  });
//注册
export const registerLogin = (data) =>
  axios({
    url: "/index/register",
    method: "post",
    data,
  });
// 获取所有管理员
export const getAdminsApi = (page, size) =>
  axios({
    url: "/api/userlist",
    method: "get",
    params: { page, size },
  });

// 获取管理员总数
export const getAdminTotalApi = () =>
  axios({
    url: "/api/usercount",
  });

// 新增
export const addAdminApi = (data) =>
  axios({
    url: "/api/useradd",
    method: "post",
    data,
  });

// 删除
export const delAdminApi = (uid) =>
  axios({
    url: "/api/userdelete",
    method: "post",
    data: { uid },
  });

// 编辑
export const editAdminApi = (data) =>
  axios({
    url: "/api/useredit",
    method: "post",
    data,
  });
